<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>值域管理<!--{if $info['name']}-->--{$info['name']}<!--{/if}--></title>
        <link href="style/default.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="./javascript/jquery.js">
        </script>
        <script type="text/javascript" src="./javascript/javascript.js">
        </script>
        <script type="text/javascript">
            function add(){
                $('.item').last().after('<tr class="item">' + $('.item').last().html() + '</tr>');
                $('input', $('.item').last()).val('');
            }
            
            function del(obj){
                var o = $(obj).parent().parent();
                var i = $('.item').index(o);
                if ($('.item').length-1>i) {
                    o.remove();
                }
            }
        </script>
    </head>
    <body>
        <!--{include nav.html}-->
        <div id="main">
            <div style="float:left;">
                <table class="list">
                    <tr>
                        <th>
                            域名称
                        </th>
                        <th class="but">
                            <a href="{$url}&amp;m=add"><img src="images/new.gif"></a>
                        </th>
                    </tr><!--{foreach $list['item'] $row}-->
                    <tr id="list_{$row['id']}" {if $row['id']==$_GET['id']}class="selected"{/if}>
                        <td>
                            <!--{$row['name']}-->
                        </td>
                        <td class="but" align="center">
                            <!--{if $row['is_sigle']=='no'}--><a href="{$url}&amp;m=add&id={$row['id']}"><img src="images/new.gif"></a><!--{/if}--><a href="{$url}&m=edit&id={$row['id']}"><img src="images/edit.gif"></a><a href="{$url}&m=del&id={$row['id']}"><img src="images/delete.gif"></a>
                        </td>
                    </tr><!--{/foreach}-->
                </table>
                <div>
                    {$mulitpage}
                </div>
            </div>
            <div style="float:left;margin-left:5px;">
                <form method="post" action="{$url}&amp;m={$_GET['m']}&amp;id={$_GET['id']}">
                    <table class="list">
                        <tr>
                            <th colspan="2">
                                <!--{if $_GET['m']=='edit'}-->修改<!--{elseif $_GET['m']=='del'}-->删除<!--{else}--> 增加<!--{/if}-->值域
                            </th>
                        </tr>
                        <!--{if $_GET['m']=='del'}-->
                        <tr>
                            <td align="center" colspan="2">
                                确认真的要删除<b>{$info['name']}</b>值域
                                <br>
                                <span class="error">删除后该值域的信息将不能恢复</span>
                            </td>
                        </tr>
                        <tr>
                            <th colspan="2">
                                <input type="submit" name="confirm" value="删除"><input type="submit" name="cancel" value="取消">
                            </th>
                        </tr><!--{else}-->
                        <tr>
                            <th>
                                域名称
                            </th>
                            <td>
                                <input type="text" name="name" value="{$info['name']}" class="short">
                            </td>
                        </tr>
                        <tr>
                            <th>
                                名称
                            </th>
                            <td>
                                <table class="list">
                                    <tr>
                                        <th>
                                            名称
                                        </th>
                                        <th>
                                            值
                                        </th>
                                        <th>
                                            排序
                                        </th>
                                        <th>
                                            <a onclick="add()"><img src="images/new.gif"></a>
                                        </th>
                                    </tr>
									<!--{foreach $info['item'] $row}-->
									<tr class="item">
                                        <td>
                                            <input type="text" name="key[{$row['id']}]" value="{$row['name']}" class="short" />
                                        </td>
                                        <td>
                                            <input type="text" name="value[{$row['id']}]" value="{$row['value']}" class="short" />
                                        </td>
                                        <td>
                                            <input type="text" name="sort[{$row['id']}]" value="{$row['sort']}" class="short" />
                                        </td>
                                        <td>
                                            <a onclick="del(this)"><img src="images/delete.gif"></a>
                                        </td>
                                    </tr>
									<!--{/foreach}-->
                                    <tr class="item">
                                        <td>
                                            <input type="text" name="newkey[]" class="short" />
                                        </td>
                                        <td>
                                            <input type="text" name="newvalue[]" class="short" />
                                        </td>
                                        <td>
                                            <input type="text" name="newsort[]" class="short" />
                                        </td>
                                        <td>
                                            <a onclick="del(this)"><img src="images/delete.gif"></a>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <th colspan="2">
                                <input type="submit" name="save" value="保存"><input type="submit" name="cancel" value="取消"><!--{if $_GET['m']=='edit'}-->
                                <input type="submit" name="del" value="删除"><!--{/if}-->
                            </th>
                        </tr><!--{/if}-->
                    </table>
                </form>
            </div>
        </div>
    </body>
</html>